<template>
  <div class="main">
    <video class="bg" autoplay  muted src="@/assets/bj.mp4"></video>
    <el-card class="box-card" style="opacity:0">
      <div slot="header"
           class="clearfix">
        <svg class="icon"
             aria-hidden="true">
          <use xlink:href="#icon-airplane-full"></use>
        </svg>
        <span>地产详情</span>
        <el-button style="float: right; padding: 3px 0" type="text" @click="back">返回</el-button>
      </div>
      <p class="arce-title">{{detailsData.title}}</p>
      <el-row type="flex" justify="space-between" class="text item">
        <el-col :span="6">
        <img style="width:216px;height:210px" :src="detailsData.image" alt="">
      </el-col>
      <el-col :span="18">
        <div class="footer">
<div class="right">
  <img v-for="(item,index) in detailsData.photos" :key="index" :src="item" alt="" >
</div>
<img class="map" src="@/assets/map.png" alt="">
</div>
      </el-col>
      </el-row>
      房源主要信息：<p style="font-weight:700" v-html="detailsData.content||'这个人很懒没有留下有价值的信息'"></p>
      <!-- 数据内容详情 -->
     <div class="left">
        <div class="item">
        <p>开盘日期：{{ detailsData.updated_at | changeTime}}</p>
      <p>更新时间：{{detailsData.updated_at | changeTime}}</p>
      </div>
      <div class="item">
        <p>地址：{{detailsData.address}}</p>
        </div>
        <div class="item">
          <p>所属房地产商：{{detailsData.category&&detailsData.category.title}}</p>
      <p>联系人：{{detailsData.agent&&detailsData.agent.name}}</p>
      </div>
      <div class="item">
        <p>联系电话：{{detailsData.agent&&detailsData.agent.phone}}</p>
        <p>联系邮箱：<span style="font-size:12px">{{detailsData.agent&& detailsData.agent.email}}</span></p>
        </div>
      <div class="item">
        <p>标签：{{detailsData.tags[0]}}</p>
      <p>标识：{{detailsData.desc}}</p>
      </div>
      <p>价格：<span style="color:#fea400">{{detailsData.price}}/m²</span></p>
    </div>
    </el-card>
  </div>
</template>

<script>
import { getDeltails } from '@/api/details'
export default {
  data () {
    return {
      detailsData: {
        category: {},
        agent: {},
        tags: []
      }
    }
  },
  created () {
    this.getDeltailsList()
  },
  methods: {
    async getDeltailsList () {
      const id = this.$store.state.arce.id
      const res = await getDeltails(id)
      this.detailsData = res.data
      console.log(this.detailsData)
    },
    back () {
      this.$router.back()
    }
  },
  mounted () {
    setTimeout(function () {
      const dom = document.querySelector('.box-card')
      // console.log(dom)
      dom.style.opacity = 1
      dom.style.transform = 'translate(0px,0px)'
    }, 0)
  }
}
</script>

<style lang="scss" scoped>
.bg{
 position: absolute;

  left: 50%;

  top: 50%;

  /*保证视频内容始终居中*/

  transform: translate(-50%, -50%);

  width: 100%;

  height: 100%;

  /*保证视频充满屏幕*/

  object-fit: cover;

  // min-height: 800px;

}
.map{
  width: 400px;
  height: 260px;
}
.main {
  width: 1000px;
  margin:auto;
  // padding: 60px 0;
  background-color: transparent;
  padding-bottom: 0;
  margin-top: 50px;
  .arce-title{
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
  }
  .text{
    img{
      height: 210px;
    }
  }
  // background-color: rgb(230, 225, 220);
  ::v-deep .el-card__header {
    padding: 0px 20px;
  }
  .clearfix {
    display: flex;
    align-items: center;
    color: #fea400;
    svg {
      fill: #fea400;
      width: 20px;
      height: 50px;
      margin-right: 10px;
    }
  }
  .footer{
    display: flex;
    align-content: space-between;
    .left{
      p{margin: 5px 0;}
      width: 230px;
    }
    .right{
      width: 340px;
      height: 210px;
      display: flex;
      flex-wrap: wrap;
      margin-left: 10px;
      align-content: space-between;
      img{
        margin-right: 10px;
        width: 150px;
        height: 100px;
      }
    }
  }
  .item{
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
  }
}
.el-card::before{
  content: "";
  display: block;
  height: 100%;
  width: 100%;
  opacity: 0.8;
  background-color: #aab4c4;
  position: absolute;
  z-index: -2;
  filter: blur(15px);
}
.el-card{
  background-color: transparent;
  position: relative;
  // color: white;
  // opacity: 0.5;
  z-index: 99;
  transition: all 2s;
  // transform: rotateZ(-60deg);
  transform: translate(-1270px);
}
img{
  cursor: pointer;
}
.el-button{
  position: absolute;
  right: 20px;
  color: black;
}
</style>
